Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First step towards replace_all operations #209

Merged
merged 15 commits into from
Feb 20, 2025
Merged

First step towards replace_all operations #209

merged 15 commits into from
Feb 20, 2025

Conversation

vhavlena
Copy link
Collaborator

@vhavlena vhavlena commented Feb 9, 2025

This PR is a first step towards handling transducer constraints (replace_all, replace_re_all). In particular:

  • Representation of transducer constraints in the Predicate class
  • Proper handling of transducer constraints in the inclusion graphs
  • Conversion of replace_all and replace_re_all into an input formula for decision procedures
  • handling transducer constraints in the preprocessing

@vhavlena
Copy link
Collaborator Author

Results:

# of formulae: 103405
--------------------------------------------------
tool                            ✅    ❌       time    avg    med    std    sat    unsat    unknown    TO    MO+ERR    other
--------------------------  ------  ----  ---------  -----  -----  -----  -----  -------  ---------  ----  --------  -------
z3-noodler-13c0fe1-9bc5557  102797   608    8566.95   0.08   0.01   1.35  63105    39692        336   201        71        0
z3-noodler-983a432-56780ef  102585   820    8384.26   0.08   0.01   1.30  63076    39509        548   195        77        0
cvc5-1.2.0                   99841  3564   73861.19   0.74   0.01   6.42  60931    38910          2  3553         9        0
z3-4.13.4                    97972  5433  107737.97   1.10   0.01   7.00  59144    38828        213  4667       483       70
--------------------------------------------------

image

@vhavlena vhavlena changed the title Support for transducer operations First step towards replace_all operations Feb 17, 2025
@vhavlena vhavlena marked this pull request as ready for review February 17, 2025 06:25
@vhavlena vhavlena requested a review from jurajsic February 17, 2025 06:25
Copy link
Member

@jurajsic jurajsic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I do not fully grasp the way replace_all* are handled.

Comment on lines +1523 to +1524
// create equation for propagating length constraints
// tmp = replace_all(...) => |tmp| = |replace_all(...)|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is confusing for me, aren't we adding this equation so we can work with the variable tmp inside the procedure? Like every other equation we create in handlers? This seems like the only reason is the lenghts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, yes but. The main reason for the equalities is the length axiom adding. The mapping tmp -> replace_all(...) is stored separately as for the other string functions. In the final check we traverse all equalitions and recursively extract calls of replace_all and replacing them with the tmp variables. But these replacements are steered only by the function symbol mapping filled in handle_replace_all (and other such functions).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it just seems weird to add such a comment here but not in other handlers (at least I feel there is something else in other handlers, am I wrong?). It seems from the comment like replace_all* have some special handling, which from the way I understood is true, but in a different way. But I do not fully understand what is happening with creating transducers, so maybe this comment makes sense here.

@vhavlena vhavlena merged commit eb33649 into devel Feb 20, 2025
3 checks passed
@vhavlena vhavlena deleted the transducers branch February 20, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants